class MainController < ApplicationController
  #首页
  def index
  end

  #查询页面
  def serach
  end

  #错误页面
  def error
  end

  def login
   if request.post? and params[:user]
     @user=User.new(params[:user])
     if user
       session[:user_id]=user.id
       redirect_to :action => "index"
     else
       @user.password=nil
       redirect_to :action =>"error"
     end
   end
  end

end
